<?php


namespace app\shop\model\user;


use think\Model;

class MessageModel extends Model
{
    protected $name = 'message';
    protected $pk = 'msg_id';
    protected $autoWriteTimestamp = true;

    protected $json = ['trans_msg', "extends", 'at'];
    protected $jsonAssoc = true;

    public function fromUser()
    {
        return $this->hasOne(UserModel::class, 'user_id', 'from_user')->bind(['from_user_name' => 'realname']);
    }
}